package main

import (
	"fmt"
	"log"
	"net/http"
)

// 创建一个空结构 hello 并为它实现 http.Handler。运行并测试。

type hello struct {
}

func (h hello) ServeHTTP(w http.ResponseWriter, req *http.Request) {
	fmt.Println("hello struct")
	fmt.Fprintf(w, "what you access path is: %s", req.URL.Path)

}

func main() {
	var h hello
	err := http.ListenAndServe(":9999", h)
	if err != nil {
		log.Fatal("ListenAndServe", err)
		return
	}
}
